<?php
// +----------------------------------------------------------------------
// | 海豚PHP框架 [ DolphinPHP ]
// +----------------------------------------------------------------------
// | 版权所有 2016~2019 广东卓锐软件有限公司 [ http://www.zrthink.com ]
// +----------------------------------------------------------------------
// | 官方网站: http://dolphinphp.com
// +----------------------------------------------------------------------

namespace app\yperp\model;

use think\Model as ThinkModel;

/**
 * 广告分类模型
 * @package app\yperp\model
 */
class YpOrderGoods extends ThinkModel
{
    // 设置当前模型对应的完整数据表名称
    protected $name = 'yperp_yporder_goods';

    // 自动写入时间戳
    protected $autoWriteTimestamp = true;
    public function yporder()
    {
        $field =  [
            'status', 'deliveryStatus', 'receiverStreet', 'receiverRegion', 'receiverName', 'memberId', 'nickName',
            'phone', 'receiverProvince', 'receiverCity',  'receiverStreet',  'receiverDetailAddress',  'receiverPhone',
            'realPayAmount',  'promotionAmount',  'integrationAmount', 'couponAmount',
        ];
        return $this->hasOne('YpOrder', 'orderCode', 'orderCode')->bind(join(',', $field));
    }

    public function ypgoods()
    {
        $field =  [
            'itemNameAlias', 'itemName', 'itemCode', 'itemCodeAlias', 'colour', 'colourAlias', 'regulatePriceMax',
            'supplyPrice', 'salePrice', 'spec',  'weight', 'goods_carriage', 'goods_fluctuation',  'sell_market_price',
            'sell_friends_price',  'sell_daily_price',  'sell_activity_price',  'sell_coupon_price',  'sell_brokerage_price',
            
        ];
        // return $this->hasOne('GoodsSkuStandby', 'goodsCode', 'itemCodeAlias')
        return $this->hasOne('GoodsSkuStandby', 'itemCodeAlias', 'goodsCode')
            ->bind(join(',', $field));
    }
}
